package com.thysdy.flowable.controller;

import com.thysdy.flowable.entity.ActIdUser;
import com.thysdy.flowable.exception.MyException;
import com.thysdy.flowable.service.IActIdUserService;
import com.thysdy.flowable.vo.ReturnVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ML
 * @since 2020-09-14
 */
@RestController
@RequestMapping("/act-id-user")
public class ActIdUserController {
    @Resource
    IActIdUserService userService;

    @PostMapping("/addUser")
    public ReturnVo addUser(@RequestBody ActIdUser user) {
        try {
            userService.addUser(user);
            return ReturnVo.success();
        } catch (MyException e) {
            return ReturnVo.exception(e);
        }
    }
    @PatchMapping("/updateUser")
    public ReturnVo updateUser(@RequestBody ActIdUser user) {
        try {
            userService.updateUser(user);
            return ReturnVo.success();
        } catch (MyException e) {
            return ReturnVo.exception(e);
        }
    }
}

